<!--
 * @Author: HeAo
 * @Date: 2021-10-09 16:02:55
 * @LastEditTime: 2021-10-09 16:28:55
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \web2103-2105\web2103code\3-2-Vue\day02\3-表单.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id="app">
    {{userInfo}}
    <form @submit.prevent="formClickHandler">
      用户名： <input type="text" v-model.lazy.trim="userInfo.username"><br>
      密码：<input type="password" v-model="userInfo.password"><br>
      手机号：<input type="number" v-model.number="userInfo.telephone"><br>
      性别：<input type="radio" value="male" v-model="userInfo.gender">男
      <input type="radio" value="female" v-model="userInfo.gender">女<br>
      爱好：<input v-model="userInfo.hobbies" type="checkbox" value="basketball"> 篮球
      <input v-model="userInfo.hobbies" type="checkbox" value="football"> 足球
      <input v-model="userInfo.hobbies" type="checkbox" value="pingpang"> 乒乓球<br>
      城市：<select v-model="userInfo.city">
        <option value="bj">北京</option>
        <option value="sz">苏州</option>
        <option value="sh">上海</option>
      </select><br>
      个人简介: <textarea v-model="userInfo.introduce" cols="30" rows="10"></textarea><br>
      <button @click="formClickHandler">提交</button>
    </form>
  </div>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {
        userInfo: {
          hobbies: []
        }
      },
      methods: {
        formClickHandler() {
          console.log(JSON.stringify(this.userInfo));
        }
      },
      created() { }
    })
  </script>
</body>

</html>